import vtkmodules.all as vtk
from CloudEngine.IO.IVTKReader import to_polydata


class IVTUReader:
    def __init__(self, url: str):
        self.reader = vtk.vtkXMLUnstructuredGridReader()
        self.reader.SetFileName(url)
        self.reader.Update()

    def output(self) -> vtk.vtkPolyData:
        return to_polydata(self.reader.GetOutput(), "Unstructured")
